package com.duan.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author db
 * @version 1.0
 * @description UserController
 * @since 2024/9/2
 */
@RestController
@RequestMapping("user")
public class UserController {

    @GetMapping("/insert")
//    @PreAuthorize("hasAnyAuthority('user:insert')")
    @PreAuthorize("hasAnyRole('user_mag')")
    public String insert(){
        return "user-insert";
    }
    @GetMapping("/update")
//    @PreAuthorize("hasAnyAuthority('user:update')")
    @PreAuthorize("hasAnyRole('user_mag')")
    public String update(){
        return "user-update";
    }

    @GetMapping("/delete")
//    @PreAuthorize("hasAnyAuthority('user:delete')")
    @PreAuthorize("hasAnyRole('hr')")
    public String delete(){
        return "user-delete";
    }


    @GetMapping("/list")
//    @PreAuthorize("hasAnyAuthority('user:list')")
    @PreAuthorize("hasAnyRole('hr')")
    public String list(){
        return "user-list";
    }
}
